<?php
	require_once dirname(BASEPATH) . '/application/models/local/data/_init_model.php';
	
	class mod_admin extends _init_model
	{
		public $ADM_ID;
		public $ADM_USERNAME;
		public $ADM_PASSWORD;
		public $ADM_NAME;
		public $ADM_EMAIL;		
		public $PMS_ID;
		
		function mod_admin(){
			parent::__construct();			
			$this->tableName = "admin";
		}
		
		function authen($username, $password){
			$this->load->library('string_function');			
			
			$sqlcmd = 'SELECT *';
			$sqlcmd .= ' FROM ' . $this->tableName;
			$sqlcmd .= ' WHERE ADM_USERNAME = ?';
			$sqlcmd .= ' AND ADM_PASSWORD = ?';
			$query = $this->db->query($sqlcmd, array($username, $this->string_function->provide_password($password)));
				
			if ($query->num_rows() > 0){
				return $query->row_array(0);
			} else
				return null;
		}
	}
?>